package com.example.element.module.service

import android.app.Service
import android.content.Intent
import android.os.Binder
import android.os.IBinder
import com.example.common.utils.L

class MyService : Service() {

    private val TAG = "MyService"
    private val mBinder=DownloadBinder()

    override fun onCreate() {
        super.onCreate()
        L.e(TAG, "onCreate")
    }

    override fun onBind(intent: Intent): IBinder {
        L.e(TAG, "onBind")
        return mBinder
    }

    override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
        L.e(TAG, "onStartCommand")
        return super.onStartCommand(intent, flags, startId)
    }

    override fun onDestroy() {
        super.onDestroy()
        L.e(TAG, "onDestroy")
    }

     class DownloadBinder : Binder() {

         private val TAG = "DownloadBinder"

        fun startDownload() {
            L.e(TAG, "startDownload")
        }

         fun getProgress(): Int {
             L.e(TAG,"getProgress")
             return 0
         }

    }
}
